import React, { Component } from 'react';
import ReactDOM from 'react-dom'

class NewPortal extends Component {
  constructor() {
    super()
    this.node = document.createElement('div');
    this.node.className = 'add-portal';
    document.body.appendChild(this.node);
  }
  render() {
    const { visible, children } = this.props
    return visible && ReactDOM.createPortal(children, this.node)
  }
}

export default NewPortal;
